package com.yc.bbs.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotEmpty;

/**
 * <p>
 * BBS论坛-帖子表-19
 * </p>
 *
 * @author k
 * @since 2024-11-25
 */
@Getter
@Setter
@TableName("tbl_topic")
public class TblTopic implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 编号, 自增列
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 标题
     */
    @TableField("title")
    @NotEmpty(message = "请输入标题")
    @Length(min=1,max=50,message = "标题必须是1-50字符")
    private String title;

    /**
     * 内容, HTML格式
     */
    @TableField("content")
    @NotEmpty(message = "请输入内容")
    @Length(min=1,max=50,message = "内容长度必须是1-20000字符")
    private String content;

    /**
     * 发表时间, 默认当前时间
     */
//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("publishtime")
    private Timestamp publishtime;
//    private LocalDateTime publishtime;

    /**
     * 修改时间, 用户最后修改回复信息的时间
     */
    @TableField("modifytime")
//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
//    private LocalDateTime modifytime;
    private Timestamp modifytime;


    /**
     * 用户编号, 发帖人
     */
    @TableField("uid")
    private Integer uid;

    /**
     * 板块编号
     */
    @TableField("boardid")
    private Integer boardid;

    @TableField(exist = false)
    private long replyCnt;

    @TableField(exist = false)
    private TblUser user;
}
